package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.query.HotelDictionaryItemQueryObject;
import cn.wolfcode.trip.base.query.HotelQueryObject;
import cn.wolfcode.trip.base.service.IHotelDictionaryItemService;
import cn.wolfcode.trip.base.service.IHotelService;
import cn.wolfcode.trip.base.service.IPointMsgService;
import cn.wolfcode.trip.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hotels")
public class HotelController {
    @Autowired
    private IHotelService hotelService;
    @Autowired
    private IPointMsgService pointMsgService;

    /*查询所有的酒店
   动作:GET
   资源:/strategys/commends
   参数:state=2
   */
    @GetMapping
    public Object listAll(){
        return hotelService.selectAll();
    }



     /*查询推荐的酒店
     动作:GET
     资源:/strategys/commends
     参数:state=2
     */
    @GetMapping("/commends")
    public Object listHotelCommend(){
        return hotelService.listCommend();
    }

    /*查询指定条件的酒店
    动作:GET
    资源:/strategys/commends
    参数:state=2
    */
    @GetMapping("/queries")
    public Object listHotelQuery(HotelQueryObject qo){
        return hotelService.listHotel(qo);
    }

     /*查询指定id的酒店
    动作:GET
    资源:/strategys/commends
    参数:state=2
    */
     @GetMapping("/{id}")
     public Object listHotelQuery(@PathVariable Long id){
         return hotelService.selectByPrimaryKey(id);
     }


    /*酒店订单
    动作:GET
    资源:/strategys/commends
    参数:state=2
  */
    @GetMapping("/orders/{userId}")
    public Object hotelOrder(@PathVariable  Long userId) {
        JSONResult result = new JSONResult();
                pointMsgService.addSystemMsg(userId);
        return result;
    }



}
